-- 卡池管理器
local BlockManager = {}
local UINodes = require("Data.UINodes")
local MathUtils = require("Utils.MathUtils")
local PrefabFactory = require("Utils.PrefabFactory")
local Consts = require("Data.Consts")

-- 在x,y坐标1-10范围内生成方块
-- 更精确的位置计算
local blockSize = 2

local destroyedBlocks = {}
-- print(cardInfos)


function BlockManager:generateBlock(height)
    print("start gen block")
    for k = 1, height do
        for i = 1, 5 do
            for j = 1, 5 do
                local x = (i - 1) * blockSize + 1
                local y = (k - 1) * blockSize + 1
                local z = (j - 1) * blockSize + 1

                G.prefabFactory:createPrefabWithCb(Consts.PrefabType.UNIT_OBSTACLE, 1073741892, math.Vector3(x, -y, z),
                    math.Quaternion(0, 0, 0), math.Vector3(2, 2, 2), function(unit)
                        -- 记录方块信息
                        -- registerBlock(unit, x, -y, z)
                        -- print("生成好了")
                        -- print(unit)
                        -- local unitId = unit.get_id()  

                        -- print(unit.get_id())

                    end)
            end
        end
    end

end



-- 测试代码

return BlockManager
